<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * Copyright (C) 2007  Robert Moss
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 

?>
<script language="javascript" type="text/javascript" src="<?=$mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>

<form action="index2.php" method="post" name="adminForm">
<div id="right">
	<div id="rightpad">
	
<!-- Header START -->
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
				<div class="far-right">
							<div class="button1-left"><div class="help"><a href="http://www.joomleague.de/handbuch.html" alt="<?php echo _JL_ADMIN_MANUAL;?>" title="<?php echo _JL_ADMIN_MANUAL;?>" target="blank"><?php echo _JL_ADMIN_MANUAL;?></a></div></div>
							<div class="button1-left"><div class="forum"><a href="http://www.joomleague.de/forum/" alt="<?php echo _JL_ADMIN_FORUM;?>" title="<?php echo _JL_ADMIN_FORUM;?>" target="blank"><?php echo _JL_ADMIN_FORUM;?></a></div></div>
							<div class="button1-left"><div class="about"><a href="http://www.joomleague.de" alt="<?php echo _JL_ADMIN_INFO;?>" title="<?php echo _JL_ADMIN_INFO;?>" target="blank"><?php echo _JL_ADMIN_INFO;?></a></div></div>
				</div>
				<div class="button1-left"><div class="blank"><a href="index2.php?option=com_joomleague"></a></div></div><span class="step"><?php echo $project->name;?><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_LIST_TEAMTOOL;?></span>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Header END -->     

    <div id="installer">
    
<!-- Title START -->     
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
      	<h2><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_TITLE;?></h2>		
<!-- Titel END -->

<!-- Info START -->	  			
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
<table class="content" cellpadding="4">
 <tr>
  <td><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_HINT1;?> 
  </td>  
 </tr>
</table>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Info END -->				

<!-- Content START -->		
				<div class="install-text2">
	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist2">
  	<thead>
    <tr>
      <th width="20">
        <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
      </th>
      <th class="title"><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_ID;?></th>
      <th width="20">&nbsp;</th>
      <th class="title" width="35%" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_TEAM;?></th>
      <th align="center" width="10%" nowrap="nowrap" align="center"><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_STARTPOINTS;?></th>
      <th class="title" width="35%" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_STARTPOINTS_REASON;?></th>
      <?php
      if ($project->project_type=='DIVISIONS_LEAGUE') {
      ?>
      <th class="title" width="30%" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_DIVISION;?></th>
      <?php } ?>
      <th class="title" width="30%" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_ADMIN;?></th>
      <th align="center" width="5%" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_FORM_TEAMTOOL_TEAMPHOTO;?></th>      
      <th align="center" width="10%" nowrap="nowrap" align="center"><?php echo "Frontend Link";?></th>      
    </tr>
  	</thead>
  <?php
  $k = 0;
  for ($i=0, $n=count( $rows ); $i < $n; $i++) {
       $row = &$rows[$i];
       $row->id=$row->teamtoolid;
       $query="SELECT name FROM #__users WHERE id=".$row->checked_out;
				$database->setQuery($query);
        		$result = $database->loadResult();
        		$row->editor=$result;		
	   mosMakeHtmlSafe($row);
       $link = 'index2.php?option=com_joomleague&act=teamtool&task=edit&cid[]='. $row->id;
       $checked = mosCommonHTML::CheckedOutProcessing( $row, $i );
       ?>
       <tr class="<?php echo "row$k"; ?>">
       <td width="20">
      <?php echo $checked; ?>
      </td>
      <td><b><?php echo $row->teamtoolid;?></b></td>
            <td width="20">
        <a href="<?php echo $link; ?>">
          <img src="<?=$mosConfig_live_site;?>/components/com_joomleague/frontend/<?=$project->template;?>/images/edit.png" border="0" alt="<?php echo _JL_EDIT_DETAILS;?>" title="<?php echo _JL_EDIT_DETAILS;?>"></a>
        </a>
      </td>
      <td width="35%">
        <a href="#setactual" onclick="return listItemTask('cb<?php echo $i;?>','setactual')" title="USE <?php echo $row->name; ?>">
          <?php echo $row->name; ?>
        </a>
      </td>
      <td align="center" width="10%">
        <?php echo $row->start_points; ?>
      </td>
      <td width="35%">
        <?php echo $row->info; ?>
      </td>
      <?php
      if ($project->project_type=='DIVISIONS_LEAGUE') {
      ?>
      <td width="30%">
        <?php echo $row->division_name; ?>
      </td>
      <?php } ?>
      </td>
      <td width="30%">
        <?php echo $row->username; ?>
      </td>
      <td width="5%" align="center">
      <?php if($row->picture == "") { ?>
      <img src="<?php echo $mosConfig_live_site;?>/administrator/components/com_joomleague/images/delete.png" alt="<?php echo _JL_ADMIN_EDIT_LIST_CLUBS_NO_LOGO;?>" title="<?php echo _JL_ADMIN_EDIT_LIST_CLUBS_NO_LOGO;?>" /></a>      
      <?php 
      } else if($row->picture == "components/com_joomleague/images/placeholders/placeholder_450.png"){?><img src="<?php echo $mosConfig_live_site;?>/administrator/components/com_joomleague/images/information.png" alt="<?php echo _JL_ADMIN_EDIT_LIST_CLUBS_LOGO_DEFAULT;?>" title="<?php echo _JL_ADMIN_EDIT_LIST_CLUBS_LOGO_DEFAULT;?>" /></a>      
      <?php 
      } else if($row->picture == !""){?><img src="<?php echo $mosConfig_live_site;?>/administrator/components/com_joomleague/images/ok.png" alt="<?php echo _JL_ADMIN_EDIT_LIST_CLUBS_LOGO_OWN;?>" title="<?php echo _JL_ADMIN_EDIT_LIST_CLUBS_LOGO_OWN;?>" /></a>
      <?php };?>
      </td>        
      <td width="10%" align="center">
      <a href="<?php printf("%s/index.php?option=%s&func=showPlayers&p=%s&ttid=%s", $mosConfig_live_site, $option, $project->id, $row->teamtoolid);?>" target="_blank">
        <?php echo sprintf("<img src=\"$mosConfig_live_site/administrator/components/com_joomleague/images/link.png\" border=\"none\" alt=\"\">");
      echo "</img>";?></a>
      </td>
      <?php
      
      $k = 1 - $k;
  } ?>
			</tr>
		</table>
				</div>
				<?php //Add a link to send a global mail to teams ?>
				<div>		
				<a href="mailto:<?php
        $first_dest = 1; 
        foreach ($rows as $r)
        {
          if (($r->club_id)>0 and strlen($r->club_email)>0)
          {
            if (!$first_dest) echo ",%20".str_replace(" ","%20",$r->club_email);
            else 
            {
              $first_dest = 0;
              echo str_replace(" ","%20",$r->club_email);
            }
          }
        }
      ?>?subject=[<?php echo $mosConfig_sitename;?>]"><?php echo _JL_ADMIN_EDIT_LIST_TEAMTOOL_EMAIL_CLUBS;?></a>
    </div>  
<!-- Content END -->	
			
        <div class="clr"></div>
      </div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
		</div>
	</div>
</div>
<div class="clr"></div>
<input type="hidden" name="id" value="<?php echo $row->id;?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="act" value="<?php echo $act; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
